#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int jisu(n,m)
{
	int a = 0;
	int b = 0;
	int c = 0;
	int i = 0;
	for (i = n; i <= m; i++)
	{
		int a = i;
		while (a)
		{
			b = a % 10;
			a /= 10;
			if (b == 2)
			{
				c++;
			}
		}
	}
	return c;
}
int main()
{
	int n = 0;
	int m = 0;
	scanf("%d %d", &n,&m);
	int w = jisu(n,m);
	printf("%d", w);
	return 0;
}